/**
 * 服务端，用于接受客户端发来的信息
 */

#include "common.hpp"

int main()
{
    //创建共享内存
    key_t key = getKey();
    int shmid = getShm(key,SIZE);
    std::cout<<"server key:"<<toHEX(key)<<std::endl;
    std::cout<<"server shmid:"<<shmid<<std::endl;
    //开始关联
    char* start = (char*)shmat(shmid,nullptr,0);
    if((void*)start==(void*)-1)
    {
        perror("shmat");
        exit(1);
    }
    //成功
    printf("server start:%p\n",start);
    sleep(3);
    return 0;
}